<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户查询报表')" />
    <th:block th:include="include :: layout-latest-css" />
    <th:block th:include="include :: ztree-css" />
</head>
<body class="gray-bg">
    <div class="ui-layout-west">
        <div class="box box-main">
            <div class="box-header">
                <div class="box-title">
                    <i class="fa icon-grid"></i> 组织机构
                </div>
                <div class="box-tools pull-right">
                    <button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
                    <button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
                    <button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新部门"><i class="fa fa-refresh"></i></button>
                </div>
            </div>
            <div class="ui-layout-content">
                <div id="tree" class="ztree"></div>
            </div>
        </div>
    </div>
    <div class="ui-layout-center">
         <div class="container-div">
            <div class="row">
                <div class="col-sm-12 search-collapse">
                    <form id="formId">
                        <input type="hidden" id="deptId" name="deptId">
                        <div class="select-list">
                            <ul>
                                <li>
                                    <label>工号：</label>
                                    <input type="text" name="userNo"/>
                                </li>
                                <li>
                                    <label>姓名：</label>
                                    <input type="text" name="name"/>
                                </li>
                                <li>
                                    <label>性别：</label>
                                    <select name="sex" th:with="type=${@dict.getType('sys_user_sex')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>用户类别：</label>
                                    <select name="userType" th:with="type=${@dict.getType('basic_user_type')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>技术类别：</label>
                                    <select name="technicalType" th:with="type=${@dict.getType('basic_user_technical')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>编制情况：</label>
                                    <select name="workDuty" th:with="type=${@dict.getType('basic_work_duty')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>职务级别：</label>
                                    <select name="dutyLevel" th:with="type=${@dict.getType('basic_duty_level')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>职位类别：</label>
                                    <select name="userPosition" th:with="type=${@dict.getType('basic_user_position')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>全日制学历：</label>
                                    <select name="educateName" th:with="type=${@dict.getType('basic_educate_name')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>最高学历：</label>
                                    <select name="educateName2" th:with="type=${@dict.getType('basic_educate_name')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>取得职称等级：</label>
                                    <select name="obtainLevel" th:with="type=${@dict.getType('basic_post_level')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li>
                                    <label>聘任职称等级：</label>
                                    <select name="postLevel" th:with="type=${@dict.getType('basic_post_level')}">
                                        <option value="">所有</option>
                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    </select>
                                </li>
                                <li class="select-time">
                                    <label>出生日期： </label>
                                    <input type="text" class="time-input" id="startTime2" placeholder="开始时间" name="params[beginTime2]"/>
                                    <span>-</span>
                                    <input type="text" class="time-input" id="endTime2" placeholder="结束时间" name="params[endTime2]"/>
                                </li>
                                <li class="select-time">
                                    <label>来院时间： </label>
                                    <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
                                    <span>-</span>
                                    <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
                                </li>
                                <li class="select-time">
                                    <label>离院时间： </label>
                                    <input type="text" class="time-input" id="startTime1" placeholder="开始时间" name="params[beginTime1]"/>
                                    <span>-</span>
                                    <input type="text" class="time-input" id="endTime1" placeholder="结束时间" name="params[endTime1]"/>
                                </li>
                                <li>
                                    <label>查询月份：</label>
                                    <input type="text" class="time-input" id="reportMonth" data-type="month" name="reportMonth" th:value="${reportMonth}"/>
                                </li>
                                <li>
                                    <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                                </li>
                            </ul>
                        </div>
                    </form>
                </div>
                <div class="btn-group-sm" id="toolbar" role="group">
                    <a class="btn btn-warning" onclick="$.table.exportExcel()">
                        <i class="fa fa-download"></i> 导出
                    </a>
                </div>
                <div class="col-sm-12 select-table table-striped">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: layout-latest-js" />
    <th:block th:include="include :: ztree-js" />
    <th:block th:include="include :: bootstrap-table-fixed-columns-js" />
    <script th:inline="javascript">
        var prefix = ctx + "report/user";

        var sexs = [[${@dict.getType('sys_user_sex')}]];
        var types = [[${@dict.getType('basic_user_type')}]];
        var nations = [[${@dict.getType('basic_user_nation')}]];
        var healths = [[${@dict.getType('basic_user_health')}]];
        var politicals = [[${@dict.getType('basic_user_political')}]];
        var positions = [[${@dict.getType('basic_user_position')}]];
        var technicals = [[${@dict.getType('basic_user_technical')}]];
        var depts = [[${@dict.getType('basic_user_dept')}]];

        var workTypes = [[${@dict.getType('basic_work_type')}]];
        var workDutys = [[${@dict.getType('basic_work_duty')}]];

        var educateNameDatas = [[${@dict.getType('basic_educate_name')}]];
        var educateDegreeDatas = [[${@dict.getType('basic_educate_degree')}]];
        var schoolTypeDatas = [[${@dict.getType('basic_school_type')}]];

        var dutyLevelDatas = [[${@dict.getType('basic_duty_level')}]];

        var postLevelDatas = [[${@dict.getType('basic_post_level')}]];
        var postTypeDatas = [[${@dict.getType('basic_post_type')}]];

        $(function() {
            var panehHidden = false;
            if ($(this).width() < 769) {
                panehHidden = true;
            }
            $('body').layout({ initClosed: panehHidden, west__size: 185 });
            // 回到顶部绑定
            if ($.fn.toTop !== undefined) {
                var opt = {
                    win:$('.ui-layout-center'),
                    doc:$('.ui-layout-center')
                };
                $('#scroll-up').toTop(opt);
            }
            queryUserList();
            queryDeptTree();
        });

        
        function queryUserList() {
            var options = {
                url: prefix + "/report_list",
                exportUrl: prefix + "/report_export",
                modalName: "用户信息",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                fixedColumns: true,
                fixedNumber: 3,
                columns: [
                    [
                        {
                            title : '基本信息',
                            align : 'center',
                            valign : 'center',
                            colspan : 19,
                            rowspan : 2
                        },
                        {
                            title : '工作情况',
                            align : 'center',
                            valign : 'center',
                            colspan : 8,
                            rowspan : 2
                        },
                        {
                            title : '学历学位',
                            align : 'center',
                            valign : 'center',
                            colspan : 11
                        },
                        {
                            title : '行政职务',
                            align : 'center',
                            valign : 'center',
                            colspan : 4,
                            rowspan : 2
                        },
                        {
                            title : '专业技术职务',
                            align : 'center',
                            valign : 'center',
                            colspan : 7,
                            rowspan : 2
                        },
                        {
                            title : '其他信息',
                            align : 'center',
                            valign : 'center',
                            colspan : 3,
                            rowspan : 2
                        }
                    ],
                    [
                        {
                            title : '全日制学历',
                            align : 'center',
                            valign : 'center',
                            colspan : 6,
                            rowspan : 1
                        },
                        {
                            title : '最高学历',
                            align : 'center',
                            valign : 'center',
                            colspan : 5,
                            rowspan : 1
                        }
                    ],
                    [
                        {
                            field: 'userId',
                            title: '用户id',
                            visible: false
                        },
                        {
                            field: 'reportMonth',
                            title: '月份'
                        },
                        {
                            field: 'userNo',
                            title: '工号'
                        },
                        {
                            field: 'name',
                            title: '姓名'
                        },
                        {
                            field: 'sex',
                            title: '性别',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(sexs, value);
                            }
                        },
                        {
                            field: 'userType',
                            title: '用户类别',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(types, value);
                            }
                        },
                        {
                            field: 'nationType',
                            title: '民族',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(nations, value);
                            }
                        },
                        {
                            field: 'phonenumber',
                            title: '手机号码'
                        },
                        {
                            field: 'idCard',
                            title: '身份证号'
                        },
                        {
                            field: 'regionName',
                            title: '籍贯'
                        },
                        {
                            field: 'birthday',
                            title: '出生年月'
                        },
                        {
                            field: 'userPosition',
                            title: '职位类别',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(positions, value);
                            }
                        },
                        {
                            field: 'userDept',
                            title: '管理部门',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(depts, value);
                            }
                        },
                        {
                            field: 'politicalType',
                            title: '政治面貌',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(politicals, value);
                            }
                        },
                        {
                            field: 'politicalTime',
                            title: '组织时间'
                        },
                        {
                            field: 'healthStatus',
                            title: '健康状况',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(healths, value);
                            }
                        },
                        {
                            field: 'technicalType',
                            title: '技术类别',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(technicals, value);
                            }
                        },
                        {
                            field: 'hospitalTime',
                            title: '来院时间'
                        },
                        {
                            field: 'leaveTime',
                            title: '离院时间'
                        },
                        {
                            field: 'deptName',
                            title: '所在科室'
                        },
                        {
                            field: 'workTime',
                            title: '工作时间'
                        },
                        {
                            field: 'seniorityStart',
                            title: '工龄起算日期'
                        },
                        {
                            field: 'workPost',
                            title: '备案岗位'
                        },
                        {
                            field: 'workStart',
                            title: '合同开始时间'
                        },
                        {
                            field: 'workEnd',
                            title: '合同结束时间'
                        },
                        {
                            field: 'workType',
                            title: '是否全职',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(workTypes, value);
                            }
                        },
                        {
                            field: 'workDuty',
                            title: '编制情况',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(workDutys, value);
                            }
                        },
                        {
                            field: 'schoolName',
                            title: '毕业院校'
                        },
                        {
                            field: 'schoolEnd',
                            title: '毕业时间'
                        },
                        {
                            field: 'educateName',
                            title: '学历',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(educateNameDatas, value);
                            }
                        },
                        {
                            field: 'educateDegree',
                            title: '学位',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(educateDegreeDatas, value);
                            }
                        },
                        {
                            field: 'educateMajor',
                            title: '专业'
                        },
                        {
                            field: 'schoolType',
                            title: '院校类型',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(schoolTypeDatas, value);
                            }
                        },
                        {
                            field: 'schoolName2',
                            title: '毕业院校'
                        },
                        {
                            field: 'schoolEnd2',
                            title: '毕业时间'
                        },
                        {
                            field: 'educateName2',
                            title: '学历',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(educateNameDatas, value);
                            }
                        },
                        {
                            field: 'educateDegree2',
                            title: '学位',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(educateDegreeDatas, value);
                            }
                        },
                        {
                            field: 'educateMajor2',
                            title: '专业'
                        },
                        {
                            field: 'dutyName',
                            title: '现任行政职务'
                        },
                        {
                            field: 'dutyStart',
                            title: '任职时间'
                        },
                        {
                            field: 'dutyLevel',
                            title: '级别',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(dutyLevelDatas, value);
                            }
                        },
                        {
                            field: 'continueTime',
                            title: '连续任该职起始时间'
                        },
                        {
                            field: 'postName',
                            title: '现取得职务资格'
                        },
                        {
                            field: 'obtainLevel',
                            title: '职称聘任等级',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(postLevelDatas, value);
                            }
                        },
                        {
                            field: 'obtainTime',
                            title: '取得时间'
                        },
                        {
                            field: 'postTitle',
                            title: '现聘任职务资格'
                        },
                        {
                            field: 'engageTime',
                            title: '聘任时间'
                        },
                        {
                            field: 'postLevel',
                            title: '职称聘任等级',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(postLevelDatas, value);
                            }
                        },
                        {
                            field: 'postType',
                            title: '现聘取得方式',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(postTypeDatas, value);
                            }
                        },
                        {
                            field: 'holdWork',
                            title: '社会兼职情况'
                        },
                        {
                            field: 'remark',
                            title: '备注'
                        },
                        {
                            field: 'remindDate',
                            title: '提醒日期',
                            align: 'center',
                            formatter: function(value, row, index) {
                                if(value == null) {
                                    var actions = [];
                                    actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="remind(\'' + row.userId + '\')"><i class="fa fa-edit"></i>用户提醒</a> ');
                                    return actions.join('');
                                }else {
                                    return value;
                                }
                            }
                        }
                    ]
                ]
            };
            $.table.init(options);
        }

        function queryDeptTree()
        {
            var url = ctx + "system/dept/treeData";
            var options = {
                url: url,
                expandLevel: 1,
                onClick : zOnClick
            };
            $.tree.init(options);

            function zOnClick(event, treeId, treeNode) {
                $("#deptId").val(treeNode.id);
                $.table.search();
            }
        }

        $('#btnExpand').click(function() {
            $._tree.expandAll(true);
            $(this).hide();
            $('#btnCollapse').show();
        });

        $('#btnCollapse').click(function() {
            $._tree.expandAll(false);
            $(this).hide();
            $('#btnExpand').show();
        });

        $('#btnRefresh').click(function() {
            queryDeptTree();
        });

        function remind(userId){
            var url = ctx + "basic/remind/" + userId;
            $.modal.open("添加用户提醒", url);
        }
    </script>
</body>
</html>